package com.xhwl.data.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.Account;
import com.xhwl.common.pojo.cent.sdata.Space;
import com.xhwl.common.query.cent.sdata.SpaceQuery;
import com.xhwl.data.pojo.space.SpaceOperateDTO;
import feign.Param;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @Author: luyi
 * @Description:
 * @Date: Create in 9:16 2021/1/21
 */
@RestController
public interface ISpaceService extends IService<Space> {

    Page<Space> page(SpaceQuery spaceQuery, Page page);

    List<Space> list(SpaceQuery spaceQuery);

    ResultJson delete(Integer id);

    /**
     * 新增/修改 传入id为修改
     *
     * @param space
     * @return
     */
    @RequestMapping(value = "/space-service/create", method = RequestMethod.POST)
    ResultJson create(@RequestPart Space space);

    /**
     * 批量创建
     *
     * @param space
     * @return
     */
    ResultJson batchCreate(List<Space> space);

    /**
     * 名称重复检查
     *
     * @param id       自定义空间的主键
     * @param name
     * @param parentId 组织表 （sdata_oragnization）的主键
     * @return
     */
    ResultJson nameCheck(Integer id, String name, Integer parentId);

	/**
	 * 空间数据批量导入
	 * @param spaces
	 * @param account
	 * @return
	 */
    ResultJson batchCreateFaster(List<Space> spaces, Account account);


    /**
     * 批量导入空间和自定义空间
     * @param file
     * @param type
     * @param projectId
     * @param account
     * @return
     */
    ResultJson batchImportSpace(MultipartFile file, Integer type, Integer projectId, Account account);

    @RequestMapping(value = "/space-service/detail", method = RequestMethod.POST)
    Space detail(@RequestPart Integer id);

    ResultJson split(SpaceOperateDTO spaceOperateDTO);

    ResultJson merge(SpaceOperateDTO spaceOperateDTO);

    ResultJson refreshSort(SpaceQuery spaceQuery);
}
